package chapter06

object Test04_Access {
  def main(args: Array[String]): Unit = {
    val person: Person = new Person()
    //person.idCard
    //person.name
    println(person.age)
    println(person.sex)
    person.printInfo()

    val worker = new Worker
    worker.printInfo()
  }
}
//定义一个子类

class Worker extends Person {
  override def printInfo(): Unit = {

    println("Worker: ")
    //    println(idCard)
    name = "bob"
    age = 25
    sex = "male"
    println(s"Worker:,name: ${name},sex: ${sex},age: ${age}")
  }
}